<?php
/*********************************************
 *  CPG Dragonfly™ CMS
 *********************************************
	Copyright © since 2010 by CPG-Nuke Dev Team
	http://dragonflycms.org

	Dragonfly is released under the terms and conditions
	of the GNU GPL version 2 or any later version

	$Source$
	$Revision$
	$Author$
	$Date$
**********************************************/

if (get_magic_quotes_gpc() || self::enabled('magic_quotes_sybase'))
{
	# Strip deprecated slashes from GPC
	function strip_magic_quotes(&$value, $key, $set=true)
	{
		if (is_array($value)) { array_walk($value, 'strip_magic_quotes', false); }
		else { $value = stripslashes($value); }
	}
	if ($_GET)    { array_walk($_GET,    'strip_magic_quotes'); }
	if ($_POST)   { array_walk($_POST,   'strip_magic_quotes'); }
	if ($_COOKIE) { array_walk($_COOKIE, 'strip_magic_quotes'); }
}

function unset_globals($keys)
{
	foreach ($keys as $key) { $GLOBALS[$key]=null; unset($GLOBALS[$key]); }
}

if (Poodle_PHP_INI::enabled('register_globals')) { unset_globals(array_keys($_REQUEST)); unset_globals(array_keys($_SERVER)); unset_globals(array_keys($_ENV)); }
if (Poodle_PHP_INI::enabled('register_long_arrays')) { unset_globals(array('HTTP_GET_VARS','HTTP_POST_VARS','HTTP_POST_FILES','HTTP_COOKIE_VARS','HTTP_SESSION_VARS','HTTP_SERVER_VARS','HTTP_ENV_VARS')); }
